<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="./common/header.jsp" %>

<body>
<%@ include file="./common/top.jsp"%>

<div class="container">
	
	<a  href="./addKhSetting.jsp" id="add_btn" style="display: none;" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i>新增</a>
	
	<div style="margin-top:20px;">
		<table id="KhSetting_table">
	
		</table>
	
	</div>
	</div>
	
		
	
	<script>
		$(function() {
			var grid = new jWei.Datagrid({
				renderTo : $("#KhSetting_table"),
				tabWidth:"",
				fieldset:false,
				legendTitle:"参数列表",
				url : "../admin/khSetting/pageList.do",
				colModels : [ 
				
				{
					name : "chance",
					displayName : "概率",
					width:'4%'
				},
				
				{
					name : "noticeTitle",
					displayName : "通知标题",
					width:'5%'
				},

				{
					name : "noticeInfo",
					displayName : "通知内容",
					width:'5%'
				},
				
				{
					name : "isNotice",
					displayName : "是否显示通知",
					width:'8%'
				},
				{
					name : "oneInit",
					displayName : "第一关初始数量",
					width:'8%'
				},
				{
					name : "oneInitS",
					displayName : "第一关初始时间",
					width:'8%'
				},
				{
					name : "oneInitC",
					displayName : "第一关通关数量",
					width:'8%'
				},

				{
					name : "twoInit",
					displayName : "第二关初始数量",
					width:'8%'
				},
				{
					name : "twoInitS",
					displayName : "第二关初始时间",
					width:'8%'
				},
				{
					name : "twoInitC",
					displayName : "第二关通关数量",
					width:'8%'
				},

				{
					name : "threeInit",
					displayName : "第三关初始数量",
					width:'8%'
				},
				{
					name : "threeInitS",
					displayName : "第三关初始时间",
					width:'8%'
				},
				{
					name : "threeInitC",
					displayName : "第三关通关数量",
					width:'8%'
				},
				{
					name : "updateDate",
					displayName : "更新时间",
					width:'5%'
				},
				
				{
					name:"id",
					displayName : "操作",
					handler:function(v,data,td,tr){
						td.html('<a href="./editKhSetting.jsp?id='+v+'" style="margin-right:5px;">编辑</a>'); 
					}
				},
				
				]
			});
			
			//显示或隐藏新增按钮
			if(grid.totalCount <=0){
				$("#add_btn").show();
			}
			
			$("#KhSetting_table").on("click",".set-show",function(){
				
				var show = $(this).data("show");
				var msg = "";
				if(show == 0){
					msg = "确定要显示网站信息";
				}else{
					msg = "确定要隐藏网站信息";
				}
				if (!confirm(msg)) {
					return;
				}
				var delObj = $(this);
				jQuery.ajax({
					type : 'Get',
					contentType : 'application/json',
					url : '../admin/webinfo/setShow.do',
					data : {
						id : delObj.data("id")
					},
					dataType : 'json',
					success : function(data) {
						if (data.result) {
							window.top.jWei.Tips.success("操作成功！");
							window.location.reload(true);
						} else {
							window.top.jWei.Tips.success(data.errorMsg);
						}
					},
					error : function(data) {
						
					}
				});
			});
	});

	</script>
</body>
</html>